import React from "react";
import { Table } from 'antd';


const AuditTable = (props: any) => {
  const columns = [
    {
      title: '序号',
      dataIndex: 'number',
      key: 'number',
    },
    {
      title: '小区名称',
      dataIndex: 'plot',
      key: 'plot',
    },
    {
      title: '标题',
      dataIndex: 'title',
      key: 'title',
    },
    {
      title: '面积',
      dataIndex: 'acreage',
      key: 'acreage',
      render: (text: any) => {
        return <span>{text}m²</span>
      }
    },
    {
      title: '总价',
      dataIndex: 'price',
      key: 'price',
      render: (text: any) => {
        return <span>{text}万</span>
      }
    },
    {
      title: '排序',
      dataIndex: 'sort',
      key: 'sort',
    },
    {
      title: '状态',
      dataIndex: 'state',
      key: 'state',
    },
    {
      title: '操作',
      key: "option",
      render: (text: any, item: any) => {
        return <div className="option-house">
          <span onClick={() => { }}>审核</span>
          <span onClick={() => { edit(item) }}>编辑</span>
          <span onClick={() => { del(item.id) }}>删除</span>
        </div>
      }
    },
  ];
  // 点击删除
  const del = (id: string) => {
    // 把id传递给父组件的删除方法
    props.delAudit(id)
  }
  // 点击编辑
  const edit = (item: any) => {
    props.editAudit(item)
  };
  return (
    <>
      {props.dataSource[0] && <Table dataSource={props.dataSource} columns={columns} rowKey={record => record.id}
        pagination={false} />}
    </>

  )
};

export default AuditTable